<?php
 $yhendus=new mysqli("localhost", "if13", "ifikad", "if13_paulamarie");
 if(isSet($_REQUEST["heaansambli_id"])){
 $kask=$yhendus->prepare("UPDATE ansamblid1 SET punktid=punktid+1 WHERE id=?");
 $kask->bind_param("i", $_REQUEST["heaansambli_id"]);
 $kask->execute();
 }
  if(isSet($_REQUEST["heaansambli2_id"])){
 $kask=$yhendus->prepare("UPDATE ansamblid1 SET punktid=punktid+2 WHERE id=?");
 $kask->bind_param("i", $_REQUEST["heaansambli2_id"]);
 $kask->execute();
 }
  if(isSet($_REQUEST["heaansambli3_id"])){
 $kask=$yhendus->prepare("UPDATE ansamblid1 SET punktid=punktid+3 WHERE id=?");
 $kask->bind_param("i", $_REQUEST["heaansambli3_id"]);
 $kask->execute();
 }
?>
<!doctype html>
<html>
 <head>
 <title>Ansamblid</title>
 </head>
 <body>
 <h1>Ansamblid</h1>
 <table>
 <?php
 $kask=$yhendus->prepare("SELECT id, ansamblinimi, punktid FROM ansamblid1");
 $kask->bind_result($id, $ansamblinimi, $punktid);
 $kask->execute();
 while($kask->fetch()){
 $ansamblinimi=htmlspecialchars($ansamblinimi);
 echo "<tr>
 <td>$ansamblinimi</td>
 <td>$punktid</td>
 <td><a href='?heaansambli_id=$id'>Lisa 1 punkt</a></td>
 <td><a href='?heaansambli2_id=$id'>Lisa 2 punkti</a></td>
 <td><a href='?heaansambli3_id=$id'>Lisa 3 punkti</a></td>
</tr>";

 }
 ?>
</table>
 </body>
</html>
<?php
 $yhendus->close();
?>